﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                assembly="KuaJing.Orders"
				        namespace="KuaJing.Orders.Domain">

  <class name="Customer" table="Customers_Customer">
    <id name="Id" access="field.camelcase" type="Int32" column="CustomerId">
      <generator class="native" />
    </id>
    <version name="Version" access="field.camelcase" />

    <property name="Name" unique="true" />
    <property name="ShortName" unique="true" />

    <property name="Provider" />
    <property name="Source"/>
    <property name="Province" />
    <property name="City" />
    <property name="SigningDate" />
    <set name="Orders" inverse="true">
      <key column="CustomerId" foreign-key="FK_Order_Customer" />
      <one-to-many class="KuaJing.Orders.Domain.Order,KuaJing.Orders" />
    </set>
 
    <many-to-one name="Butler" column="ButlerId" foreign-key="FK_Customer_Butler_Employee" />
    <many-to-one name="Sales" column="SalesId" foreign-key="FK_Customer_Sales_Employee" />

    <many-to-one name="FirstOrder" column="FirstOrderId" foreign-key="FK_Customer_FirstOrder" />
    <property name="FirstOrderDate" access="field.camelcase" />

    <property name="CreatedTime" access="field.camelcase" />
    <property name="CreatedUserName" access="field.camelcase" />
    <property name="ModifiedTime" access="field.camelcase" />
    <property name="ModifiedUserName" access="field.camelcase" />
    <property name="AccessedTime" access="field.camelcase" />
    <property name="AccessedUserName" access="field.camelcase" />
    <property name="Memo" />
    <property name="IsInvalid" />
  </class>
</hibernate-mapping>
